package com.jzm;

import com.jzm.controller.UserController;
import com.jzm.entity.User;

import java.lang.reflect.*;

public class LearnDemo {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException, InvocationTargetException {
        Class<UserController> userControllerClass = UserController.class;

       /* Method[] methods = userControllerClass.getMethods();
        for (Method method : methods) {
            if("createUser".equals(method.getName())){
                System.out.println(method.getReturnType());
                Class<?>[] parameterTypes = method.getParameterTypes();
                for (Class<?> parameterType : parameterTypes) {
                    System.out.println(parameterType);
                }

                //构建一个User对象
                User user = new User();
                user.setUserName("tiger");
                user.setPassword("07293r498237");

                method.invoke(userControllerClass.newInstance(),user);

                break;
            }
        }*/


        //成员变量
        Field[] fields = userControllerClass.getDeclaredFields();
        for (Field field : fields) {
            System.out.println(field.getName());
        }


    }
}
